a = input('Введите скобочную последовательность:')
for i in range(len(a)):
    if a[i] == '(' :
        if a[i+1] == ')' or a[i+2] == ')':
            print('True')
            break
        else:
            print('False')
            break
    if a[i] == '[':
        if a[i+1] == ']' or a[i+2] == ']':
            print('True')
            break
        else:
            print('False')
            break
    if a[i] == '{':
        if a[i+1] == '}' or a[i+2]== '}':
            print('True')
            break
        else:
            print('False')
            break
    if a[i] == '<':
        if a[i+1] == '>' or a[i+2]== '>':
            print('True')
            break
        else:
            print('False')
            break
    if a[i] == ' ':
        if a[i+1] == ' ' or a[i+2]== ' ':
            print('True')
            break
        else:
            print('False')
            break
    else:
        print('False')
        break
